import java.util.HashSet;
import java.util.Random;
import java.util.Set;



public abstract class Oracle {
	public static final int  NUM = 20;

	
	//public Oracle(){};
	
	public double euclideanNormSquared(int N){
		int num = Math.min(N, NUM);
		Set<Integer> s = new HashSet<Integer>();
		int i = 0;
		int index = 0;
		double sum = 0;
		Random rnd = new Random();
		while(i < num){
			index = rnd.nextInt(N);
			if(!s.contains(index)){
				s.add(index);
				i++;
			}				
		}
		for(Integer x : s){
			sum += Math.pow(this.query(x).getNorm(), 2);
		}
		
		return (double)((1 / num) * sum);
	}
	
	public abstract Complex query(int q);
}

